function sendVCode() {
    var account = $("#account").val();
    var email = $("#email").val();
    if (account.length === 0 || email.length === 0) {
        alert("账号或者邮箱不能为空");
        return;
    }
    let btnSendVcode = $("#btn-send-vcode");
    btnSendVcode.attr("disabled", true);
    btnSendVcode.val("正在发送验证码,请稍等...");
    $.ajax({
        url: "/user/verify/create?account=" + account + "&email=" + email + "&vmode=email",
        type: "GET",
        success: function (result) {
            try {
                if (result.success) {
                    btnSendVcode.disabled = true;
                    btnSendVcode.val(result.msg);
                }
                alert(result.msg);
            } catch (e) {
                btnSendVcode.val("发送验证码");
                alert(e.measure());
            } finally {
                btnSendVcode.attr("disabled", false);
            }
        }
    });
}
function login() {
    var account = $("#account").val();
    var token = $("#token").val();
    $.ajax({
        url: "/user/verify/login?username=" + account + "&token=" + token,
        type:"GET",
        success:function (result) {
            try {
                var resultJson = JSON.parse(result);
                var isSuccess = resultJson["success"];
                var resultError = resultJson["error"];
                if (isSuccess) {
                    var privilege = resultJson["privilege"];
                    if (privilege === "普通用户") {
                        window.location.href = "/";
                    } else if (privilege === "超级管理员") {
                        window.location.href = "/admin/index";
                    } else {
                        alert("登录成功,但是权限出现异常");
                    }
                } else {
                    if (resultError == null) {
                        alert("登录失败!");
                    } else {
                        alert(resultError);
                    }
                }
            } catch (e) {
                alert("登录异常");
            }
        }
    });
}